
import java.math.BigDecimal;

public class FeeCaculation {
    private FeeCaculation() {
    }
    public static BigDecimal calculateTimeSpan(long time) {
        BigDecimal fee;
        if (time > 30 * 60 || time <= 0) {
            return BigDecimal.ZERO;
        }
        if (time > 20) {
            fee = BigDecimal.valueOf(1 + 0.1 * (time - 20));
        }
        else {
            fee = BigDecimal.valueOf(0.05 * time);
        }
        return fee.setScale(2, BigDecimal.ROUND_HALF_UP);
    }
}
